<template>
  <div class="description-editor">
    <div class="title-container">
      <h2 class="title">
        <span class="title-text">文字描述框</span>
        <span class="title-border"></span>
      </h2>
    </div>

    <!-- 固定大小的文字描述框 -->
    <div class="fixed-description">
      <div class="text-description" v-for="(desc, index) in description" :key="index">
        {{ desc }}
      </div>
    </div>

    <!-- 添加文字描述框 -->
    <div class="text-description">
      <!-- 第一个描述框特殊样式，并添加输入新描述的功能 -->
      <div class="text-description first-description">
        <input type="text" v-model="newDescription" placeholder="输入新描述..." class="description-input" />
        <button class="green-button" @click="addNewDescription">添加</button>
      </div>
    </div>

    <!-- 自动生成文字描述按钮 -->
    <div class="text-description">
      <button class="green-button generate-button" @click="generatePhoto">
        根据文字描述生成图片
      </button>
    </div>
    <!-- 自动生成文字描述按钮 -->
    <div class="text-description">
      <button class="green-button generate-button" @click="gotoautogenerate">
        输入关键词，让AI帮你生成
      </button>
    </div>
    <div class="text-description">
      <button class="green-button generate-button" @click="generateMood">
        自动生成心情标签
      </button>
    </div>
    <Mood/>
    <button @click="back">返回地点详情页</button> <!-- 添加按钮 -->
  </div>
</template>

<script>
import Mood from './Mood.vue';
export default {
  props: ['description', 'placeID'],
  components: {
    Mood,
  },
  data() {
    return {
      newDescription: '',
      description: '',
    };
  },
  methods: {
    
    addNewDescription() {
      if (this.newDescription.trim() !== '') {
        this.description.push(this.newDescription);
        this.newDescription = '';
      }
    },
    generatePhoto(){},
    generateMood(){},
    gotoautogenerate()
    {
      this.$router.push({ name: 'geneDes' ,params: {
        placeId: this.placeId}});
    },
  },
};
</script>

<style scoped>
.description-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'SimSun', serif; /* 使用思源宋体 */
  font-size: 16px; /* 文字大小 */
  height: 100vh;
}

.title-container {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.title {
  background-color: rgba(180, 237, 235, 0.8);
  border-radius: 10px;
  padding: 10px 20px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 600px;
}

.title-text {
  display: inline-block;
  padding: 0 20px;
  position: relative;
  z-index: 2; /* Adjusted for better layer management */
  font-family: 'Segoe UI', 'Roboto', sans-serif; /* More modern and readable font */
  font-size: 18px;
  font-weight: bold;
  color: #333;
  box-shadow: 0 4px 8px rgba(250, 249, 249, 0.05); /* Softer shadow for depth */
  border-radius: 4px; /* Keeping rounded corners for softness */
}

.title-border {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px; 
  z-index: 1;
}

.fixed-description {
  width: 80%;
  max-width: 600px;
  padding: 20px;
  height: 400px;
  max-height: 600px;
  overflow-y: auto;
  border: 2px solid rgba(180, 237, 235, 0.8);
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  font-family: 'SimSun', serif;
  font-size: 16px;
  margin-bottom: 20px;
}

.text-description {
  font-family: 'SimSun', serif;
  font-size: 16px;
  margin-bottom: 15px;
}

.first-description {
  display: flex;
  align-items: center;
}

.description-input {
  font-family: 'SimSun', serif;
  border-radius: 8px;
  border: 2px solid rgba(180, 199, 199, 0.8);
  padding: 8px 12px;
  flex-grow: 1;
  margin-right: 10px;
}

.description-input:focus {
  outline: none;
  border-color: rgba(120, 200, 198, 0.8);
}

.green-button {
  background-color: rgba(189, 243, 241, 0.8);
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: 'SimSun', serif;
  font-size: 16px;
  color: #333;
  transition: background-color 0.3s ease;
}

.green-button:hover {
  background-color: rgba(150, 235, 233, 0.8);
}

.generate-button {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}
</style>



